<template>
	<view>
	<view class="address-item" v-for="item in addressList" :key="item.id" @click="reviseod(item.id)">
		<view class="item-left">
		<view class="left-top">
			<view class="mark" v-if="item.label">{{item.label}}</view>
			<text class="item-cont">{{item.detail}}</text>
		</view>
		<view class="item-user"><text>{{item.name.charAt(0)}} &nbsp;&nbsp;先生
		</text>{{item.phone.slice(0, 3) +"****" + item.phone.slice(9)}}</view>
		</view>
		<view @click.stop="edit(item.id)" class="iconfont icon-bianji" style="font-size: 36rpx;color: #999;"></view>
	</view>
	</view>
</template>

<script>
	import {mapMutations} from 'vuex'
	export default{
		props:{
			addressList:{
				type:Array,
				default:() =>[]
			},
			state:{
				type:String,
				default:''
			}
		},
		data(){
			return{
				dellist:null
			}
		},
		methods:{
			...mapMutations(['setodres']),
			reviseod(id){
				this.setodres(id)
				if(this.state === 'revise'){
					uni.navigateBack({delta:1})
				}
			},
			edit(id){
				uni.navigateTo({
					url:`/page_my/my-address/addaddress?id=${id}&type='edit'`
				})
			}
		}
	}
</script>

<style lang="scss">
	.address-item{
		display: flex;
		align-items: center;
		justify-content: space-between;
		&:nth-child(n+1){
			margin-top: 20rpx;
		}
		.item-left{
			.left-top{
				display: flex;
			.mark{
				padding: 3rpx 20rpx;
				font-size: 24rpx;
				border-radius: 60px;
				border: 2rpx solid #025E21;
				color: #025E21;
				opacity: 0.6;
				margin-right: 25rpx;
			}
			}
			.item-cont{
				font-size: 30rpx;
				font-weight: bold;
			}
			.item-user{
				color: #999;
				font-size: 24rpx;
				margin-top: 12rpx;
			}
		}
	}
</style>